#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
#include <list>
using namespace std;
namespace bit
{
	template<class T>
	class shared_ptr {
	public:
		shared_ptr(T* ptr)
			:_ptr(ptr)
			, _current(new int(1))
		{}
		shared_ptr(const shared_ptr<T>& sp)
			:_ptr(sp._ptr)
			, _current(sp._current)
		{
			(*_current)++;
		}
		void release() {
			if (--(*_current) == 0)
			{
				delete(_ptr);
				delete(_current);
			}
		}
		shared_ptr<T>& operator=(const shared_ptr<T>& sp)
		{
			if (_ptr == sp._ptr)
			{
				release();
				_ptr = sp._ptr;
				_current = sp._current;
			}
			return this;
		}
		~shared_ptr() {
			release();
		}
		T& operator* () {
			return *_ptr;
		}
		T* operator->() {
			return _ptr;
		}
		int use_count() {
			return *_current;
		}
	private:
		T* _ptr;
		int* _current;
	};
}
int main()
{
	return 0;
}
